A directed graph may include multiple interconnected nodes where the nodes represent steps in a process. The nodes may be connected to each other in particular directions to indicate an order of the steps associated with the nodes. An optimized directed graph may include a more efficient version of the directed graph where multiple nodes converge to the same node. An optimized directed graph may be used to represent the flow of different types of processes, such as steps in software source code or hardware logic.